using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DataModels.Models
{
    [Table("Region")]
    public partial class Region : IComparable
    {
        /// <summary>
        /// This is the nam of testing region. It is used only for testing.
        /// </summary>
        public const string TESTING_REGION_NAME = "TESTING REGION";

        public Region()
        {
            this.Districts = new List<District>();
        }

        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int RegionNo { get; set; }

        [StringLength(50)]
        [Required]
        public string RegionName { get; set; }

        [StringLength(50)]
        [Required]
        public string RegionCode { get; set; }

        public virtual AutoReminderRegion AutoReminderRegion { get; set; }
        public virtual List<District> Districts { get; set; }
        //public virtual List<Facility> Facilities { get; set; }

        public int CompareTo(object obj)
        {
            if (obj == null) return 1;

            Region otherRegion = obj as Region;
            if (otherRegion != null) return this.RegionName.CompareTo(otherRegion.RegionName);
            else throw new ArgumentException("Object is not a Region");
        }
    }
}
